<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
				 java.util.ArrayList" %>
<%@ page import="com.scalar.chiptrack.users.Functionality"%>
<%@ page import="com.scalar.chiptrack.users.User"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/tapeReelRequest.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>

<script language="javascript">

    var dateElement = "";
    function openCalendar(dateValue)
    {
        dateElement = dateValue;
        newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
        newWindow.moveTo(550,180);
        newWindow.focus();
    }
    function assignDate(passedValue)
    {
        dateElement.value=passedValue;
        window.focus();
    }
    function validateForm()
    {
        var form = document.tapeReelRequestForm;
        var pa = document.getElementById( "errors" );
        if(chkDate(form['tapeReelRequest.fromDate'].value,'From-Date','N') == false)
        {
            pa.innerHTML = errMsg;
            form['tapeReelRequest.fromDate'].focus();
            return false;
        }

        if(chkDate(form['tapeReelRequest.toDate'].value,'To-Date','N') == false)
        {
            pa.innerHTML = errMsg;
            form['tapeReelRequest.toDate'].focus();
            return false;
        }

        if(form['tapeReelRequest.fromDate'].value!='' && form['tapeReelRequest.toDate'].value!='')
        {
            if (!validateDateOut(formatDateAsMMDDYYYY(form['tapeReelRequest.fromDate'].value),formatDateAsMMDDYYYY(form['tapeReelRequest.toDate'].value)))
            {
                pa.innerHTML = "To Date cannot be less than From Date";
                form['tapeReelRequest.toDate'].focus();
                return false;
            }
        }
        return true;
    }

    function search()
    {
        if ( validateForm() )
        {
            document.tapeReelRequestForm.action	= "<%=chipTracContext%>/tapeReelRequest.do?action=search";
            document.tapeReelRequestForm.submit();
        }

    }

</script>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<!-- Top Header Start-->

<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TR>
	    <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
			<%
				if( user.getUserType() == 0 )
				{
			%>
            <%@ include file="/jsp/operations/releaseMenu.jsp" %>
			<%
				}
				else
				{
			%>
			<%@ include file="/jsp/admin/externaluser_menu.jsp" %>
			<%
				}	
			%>
            <!-- end of the side navigations -->
        <td bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <td bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <td valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR>
            <html:form name="tapeReelRequestForm" type="com.scalar.chiptrack.operations.tapereel.forms.TapeReelRequestForm" action="/tapeReelRequest">
            <nested:nest property="tapeReelRequest" >
            <table border="0" width="100%" align=center>
                <tr><td colspan=5 class="NArialW" align="center">Tape and Reel Request Search</TD></TR>
                <tr><td colspan=5>&nbsp;</td></tr>
                <tr><td colspan=5 class='NArialL'><strong><FONT id="message" styleClass="NArialL" color='FF0000'></FONT></strong></td></tr>
                <tr>
                    <td colspan=5>
                        <chiptrack:info styleClass="NArialL" />
                        <chiptrack:errors styleClass="NArialL" />
                        <chiptrack:messages type="info" styleClass="NArialL" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <table align="center" border="0" width="90%" cellpadding="3" cellspacing="3">
                            <tr>
                                <td width="10%" class="NArialL">&nbsp;</td>
                                <td width="18%" class="NArialL">TR Part Number:</td>
                                <td width="20%" class="NArialL">
                                    <nested:select property="trProcessStepId" styleClass="txfield" style="width:150px">
                                        <html:option value="">All TR Part Numbers</html:option>
                                        <html:options collection="partNumbersList" property="value" labelProperty="label"/>
                                    </nested:select>
                                </td>
                                <td width="5%" class="NArialL">&nbsp;</td>
                                <td width="15%" class="NArialL">Vendor:</td>
                                <td width="30%" class="NArialL">
                                    <nested:select property="trlocationId" styleClass="txfield" style="width:150px">
                                        <html:option value="">All Vendors</html:option>
                                        <html:options collection="vendorsList" property="value" labelProperty="label"/>
                                    </nested:select>
                                </td>                                
                            </tr>
                            <tr>
                                <td class="NArialL">&nbsp;</td>
                                <td class="NArialL">Status : </td>
                                <td class="NArialL">
                                    <nested:select property="reqStatus" name="tapeReelRequestForm" styleClass="txfield" style="width:150px">
                                        <html:option value="">------All------</html:option>
                                        <html:options collection="statusList" property="value" labelProperty="label"/>
                                    </nested:select>
                                </td>
                                <td width="5%" >&nbsp;</td>
                                <td class="NArialL">&nbsp;&nbsp;</td>
                                <td class="NArialL">&nbsp;&nbsp;</td>

                            </tr>
                            <tr>
                                <td width="10%" class="NArialL">&nbsp;</td>
                                <td width="18%" class="NArialL" nowrap>
                                    From-Date:
                                </td>
                                <td width="20%" class="NArialL">
                                    <nested:text property="fromDate" styleClass="txfield" size="12"/>
                                    <a href="javascript:openCalendar(document.tapeReelRequestForm['tapeReelRequest.fromDate'])">
                                    <img onMouseOver="window.status='Click here to select From Date';return true" onMouseOut="window.status='';return true" border="0" align='center' title="Click here to Select From Date"
                                    src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=17 width=17></a>
                                </td>
                                <td class="NArialL" width="5%">&nbsp;</td>
                                <td width="15%" class="NArialL">To-Date:</td>
                                <td width="20%" class="NArialL">
                                    <nested:text property="toDate" styleClass="txfield" size="12"/>
                                    <a href="javascript:openCalendar(document.tapeReelRequestForm['tapeReelRequest.toDate'])">
                                    <img onMouseOver="window.status='Click here to select TO Date';return true" onMouseOut="window.status='';return true" border="0" align='center' title="Click here to Select To Date"
                                    src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=17 width=17></a>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="6"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td>
                            </tr>
                            <tr>
                                <td colspan="6" align=center>
                                    <a href="javascript:search();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Search Tape & Reel Request';return true" onmouseout="window.status='';return true" title="Click here to Search Tape & Reel Request"></a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href="javascript:document.tapeReelRequestForm.reset();"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to reset search';return true" onmouseout="window.status='';return true" title="Click here to reset search"></a>

                                </td>
                            </tr>
                            <tr>
                                <td colspan='6' align="center">
                                    <table width="90%" align="center" cellpadding="2" cellspacing="2" border="0">
                                        <tr>
                                            <td class="NArialL">
											<%
											if( user.getUserType() == 0 )
											{
											%>
                                                <chiptrack:restrictedLink functionality='<%=Functionality.TAPE_REEL_REQUEST %>' action='<%=User.USER_ACTION_MODIFY%>'
                                                                          styleClass="leftsection" href='<%=chipTracContext+"/tapeReelRequest.do?action=new"%>'
                                                                          onmouseover="window.status='Click to Create Tape & Reel Request';return true"
                                                                          onmouseout="window.status='';return true">Click Here</chiptrack:restrictedLink> To
                                                Generate New Tape & Reel Request
											<%
											}
											else
											{
											%>
											&nbsp;
											<%
											}	
											%>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>           
                            <tr><td colspan="6"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                            <logic:present name="searchList" scope="request">
                            <tr>
                                <td colspan='6' align="center">
                                    <table width="100%" align="center" cellpadding="2" cellspacing="2" border="0">
                                        <tr>
                                            <td width="10%" class="NArialL" bgcolor="#993333" nowrap align="center">
                                                <font color="#FFFFFF">Work Order No</font>
                                            </td>
                                            <td width="15%" class="NArialL" bgcolor="#993333" nowrap align="center">
                                                <font color="#FFFFFF">Part Number</font>
                                            </td>
                                            <td width="10%" class="NArialL" bgcolor="#993333" nowrap align="center">
                                                <font color="#FFFFFF">Vendor</font>
                                            </td>
                                            <td width="8%" class="NArialL" bgcolor="#993333" nowrap align="center">
                                                <font color="#FFFFFF">Required Qty </font>
                                            </td>
                                            <td width="8%" class="NArialL" bgcolor="#993333" nowrap align="center">
                                                <font color="#FFFFFF">Pulled Qty </font>
                                            </td>
                                            <td width="10%" class="NArialL" bgcolor="#993333" nowrap align="center">
                                                <font color="#FFFFFF">Req Date</font>
                                            </td>
                                            <td width="10%" class="NArialL" bgcolor="#993333" align="center">
                                                <font color="#FFFFFF">Status</font>
                                            </td>
                                            <td width="25%" class="NArialL" bgcolor="#993333" nowrap align="center">
                                                <font color="#FFFFFF"> Actions</font>
                                            </td>
                                        </tr>
                                        <logic:iterate name="searchList" id="tapeReelRequest"  indexId="iteratorIdx" >
                                        <tr <%if(iteratorIdx.intValue()%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>

                                            <td width="10%" class="NArialL" align="center" NOWRAP>
                                                <bean:write name="tapeReelRequest" property="workOrderNo" />
                                            </td>
                                            <td width="15%" class="NArialL" align="center" NOWRAP>
                                               <bean:write name="tapeReelRequest" property="trPartNumber" />
                                            </td>
                                            <td width="10%" class="NArialL" align="center" NOWRAP>
                                                <bean:write name="tapeReelRequest" property="vendor" />
                                            </td>
                                             <td width="8%" class="NArialL" align="center" NOWRAP>
                                                <bean:write name="tapeReelRequest" property="reqQty" />
                                            </td>
                                            <td width="8%" class="NArialL" align="center" NOWRAP>
                                                <bean:write name="tapeReelRequest" property="qtyPulled" />
                                            </td>
                                             <td width="10%" class="NArialL" align="center" NOWRAP>
                                                <bean:write name="tapeReelRequest" property="reqDate" />
                                            </td>
                                             <td width="10%" class="NArialL" align="center" NOWRAP>
                                                <bean:write name="tapeReelRequest" property="reqStatus" />
                                            </td>
                                            <td width="25%" class="NArialL" align="center" NOWRAP>
												<table border =0>
													<tr class="NArialL" NOWRAP>
                                               <logic:equal name="tapeReelRequest" property="reqStatus" value='Issued'>
														<td width="25%">
															<a href='<%=chipTracContext%>/tapeReelRequest.do?action=view&trReqId=<bean:write name="tapeReelRequest" property="trRequestid" />' onMouseOver="window.status='Click to View Tap & Reel Request';return true" onMouseout="window.status='';return ">View</a>
														</td>
														<td width="25%">
															<a href='<%=chipTracContext%>/tapeReelRequest.do?action=modify&trReqId=<bean:write name="tapeReelRequest" property="trRequestid" />' onMouseOver="window.status='Click to Edit Tap & Reel Request';return true" onMouseout="window.status='';return ">Edit</a>
														</td>
														<td width="25%">
															<a href='<%=chipTracContext%>/tapeReelRequest.do?action=cancel&trReqId=<bean:write name="tapeReelRequest" property="trRequestid" />' onMouseOver="window.status='Click to Cancel this Tap & Reel Request';return true" onMouseout="window.status='';return ">Cancel</a>
														<td width="25%">
															&nbsp;
														</td>														
                                                </logic:equal>
                                                <logic:equal name="tapeReelRequest" property="reqStatus" value='Pulled'>
														<td width="25%">
															<a href='<%=chipTracContext%>/tapeReelRequest.do?action=view&trReqId=<bean:write name="tapeReelRequest" property="trRequestid" />' onMouseOver="window.status='Click to View Tap & Reel Request';return true" onMouseout="window.status='';return ">View</a>
														</td>
														<td width="25%">
															<a href='<%=chipTracContext%>/tapeReelRequest.do?action=modify&trReqId=<bean:write name="tapeReelRequest" property="trRequestid" />' onMouseOver="window.status='Click to Edit Tap & Reel Request';return true" onMouseout="window.status='';return ">Edit</a>
														</td>
														<td width="25%">
															<a href='<%=chipTracContext%>/tapeReelRequest.do?action=cancel&trReqId=<bean:write name="tapeReelRequest" property="trRequestid" />' onMouseOver="window.status='Click to Cancel this Tap & Reel Request';return true" onMouseout="window.status='';return ">Cancel</a>
														</td>
														<td width="25%">
														<logic:equal name="tapeReelRequest" property="buyIn" value='0'>
															<a href='<%=chipTracContext%>/tapeReelRequest.do?action=close&trReqId=<bean:write name="tapeReelRequest" property="trRequestid" />' onMouseOver="window.status='Click to Buy In this Tap & Reel Request';return true" onMouseout="window.status='';return ">BuyIn</a>
														</logic:equal>
														<logic:notEqual name="tapeReelRequest" property="buyIn" value='0'>
															&nbsp;
														</logic:notEqual>
														</td>
                                                </logic:equal>
                                                <logic:equal name="tapeReelRequest" property="reqStatus" value='Cancelled'>
														<td width="25%" align='left'>
															<a href='<%=chipTracContext%>/tapeReelRequest.do?action=view&trReqId=<bean:write name="tapeReelRequest" property="trRequestid" />' onMouseOver="window.status='Click to View Tap & Reel Request';return true" onMouseout="window.status='';return ">View</a>
														</td>
														<td width="25%">
															&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
														</td>
														<td width="25%">
															&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
														</td>
														<td width="25%">
															&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
														</td>
                                                </logic:equal>
                                                <logic:equal name="tapeReelRequest" property="reqStatus" value='Closed'>
														<td width="25%" align="left">
															<a href='<%=chipTracContext%>/tapeReelRequest.do?action=view&trReqId=<bean:write name="tapeReelRequest" property="trRequestid" />' onMouseOver="window.status='Click to View Tap & Reel Request';return true" onMouseout="window.status='';return ">View</a>														
														</td>
														<td width="25%">
															&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
														</td>
														<td width="25%">
															&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
														</td>
														<td width="25%">
															&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
														</td>
                                                </logic:equal>
														</tr>
													</table>
                                            </td>
                                        </tr>
                                        </logic:iterate>
                                    </table>
                                </td>
                            </tr>
                            </logic:present>
                        </table>
                    </td>
                </tr>
            </table>
            </nested:nest>
            </html:form>
        </td>
    </tr>
</table>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>
